<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>社交活动平台 - 地理位置选择</title>
    <style>
        /* 重置样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        /* 容器样式 */
        .container {
            max-width: 480px;
            margin: 0 auto;
            background-color: #fff;
            min-height: 100vh;
        }

        /* 头部导航 */
        .header {
            position: sticky;
            top: 0;
            background-color: white;
            padding: 16px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 100;
        }

        .header-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .back-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #333;
        }

        .header-title {
            font-size: 18px;
            font-weight: bold;
            flex-grow: 1;
            text-align: center;
        }

        .action-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #333;
        }

        /* 搜索区域 */
        .search-section {
            padding: 16px;
            background-color: #f9f9f9;
            border-bottom: 1px solid #eee;
        }

        .search-container {
            display: flex;
            align-items: center;
            background-color: white;
            border-radius: 24px;
            padding: 8px 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .search-icon {
            color: #999;
            margin-right: 8px;
        }

        .search-input {
            flex-grow: 1;
            border: none;
            outline: none;
            font-size: 15px;
            background-color: transparent;
        }

        /* 地图区域 */
        .map-section {
            height: 250px;
            background-color: #e3f2fd;
            position: relative;
            overflow: hidden;
        }

        .map-placeholder {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #666;
        }

        .map-marker {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 32px;
            height: 32px;
            background-color: #ff6b35;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { transform: translate(-50%, -50%) scale(1); }
            50% { transform: translate(-50%, -50%) scale(1.1); }
            100% { transform: translate(-50%, -50%) scale(1); }
        }

        /* 当前位置区域 */
        .current-location {
            padding: 16px;
            border-bottom: 1px solid #eee;
        }

        .location-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 16px;
        }

        .location-icon {
            font-size: 24px;
            color: #ff6b35;
        }

        .location-info {
            flex-grow: 1;
        }

        .location-name {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 4px;
        }

        .location-address {
            font-size: 14px;
            color: #666;
        }

        .location-actions {
            display: flex;
            gap: 12px;
        }

        .action-btn {
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .use-location-btn {
            background-color: #e3f2fd;
            color: #1976d2;
            border: 1px solid #bbdefb;
        }

        .use-location-btn:hover {
            background-color: #bbdefb;
        }

        /* 地区选择区域 */
        .region-section {
            padding: 16px;
        }

        .section-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 16px;
        }

        .region-list {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }

        .region-item {
            padding: 10px 16px;
            background-color: #f0f0f0;
            border-radius: 24px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .region-item:hover {
            background-color: #e0e0e0;
            transform: translateY(-2px);
        }

        .region-item.active {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 搜索结果区域 */
        .search-results {
            padding: 16px;
        }

        .results-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .results-title {
            font-size: 18px;
            font-weight: bold;
        }

        .results-count {
            color: #666;
            font-size: 14px;
        }

        .result-item {
            display: flex;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid #eee;
            cursor: pointer;
        }

        .result-item:last-child {
            border-bottom: none;
        }

        .result-icon {
            font-size: 20px;
            margin-right: 12px;
            color: #ff6b35;
        }

        .result-info {
            flex-grow: 1;
        }

        .result-name {
            font-size: 16px;
            margin-bottom: 4px;
        }

        .result-address {
            font-size: 14px;
            color: #666;
        }

        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: white;
            border-top: 1px solid #eee;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #9e9e9e;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-item.active {
            color: #ff6b35;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }

        /* 加载动画 */
        .loading {
            text-align: center;
            padding: 40px 20px;
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid #ff6b35;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 16px;
            width: 85%;
            max-width: 320px;
            padding: 24px;
            text-align: center;
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease;
        }

        .modal.show {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 16px;
            color: #333;
        }

        .modal-message {
            margin-bottom: 24px;
            color: #666;
            line-height: 1.6;
        }

        .modal-actions {
            display: flex;
            gap: 12px;
        }

        .modal-btn {
            flex: 1;
            padding: 12px;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cancel-btn {
            background-color: #f5f5f5;
            color: #666;
        }

        .confirm-btn {
            background: linear-gradient(135deg, #ff6b35 0%, #f9a825 100%);
            color: white;
        }

        /* 响应式适配 */
        @media (max-width: 480px) {
            .header-content {
                padding-top: 4px;
            }
            
            .map-section {
                height: 200px;
            }
        }

        /* 动画效果 */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .result-item {
            animation: fadeInUp 0.6s ease forwards;
        }

        /* 地理位置图标 */
        .icon-location { color: #ff6b35; }
        .icon-map-pin { color: #45b7d1; }
        .icon-search { color: #9e9e9e; }

        /* 空状态 */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
        }

        .empty-icon {
            font-size: 48px;
            margin-bottom: 20px;
            color: #ccc;
        }

        .empty-title {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 12px;
            color: #666;
        }

        .empty-description {
            color: #999;
            margin-bottom: 24px;
        }

        /* 当前位置指示器 */
        .location-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 4px;
        }

        .indicator-dot {
            width: 8px;
            height: 8px;
            background-color: #4caf50;
            border-radius: 50%;
        }

        .indicator-text {
            font-size: 12px;
            color: #4caf50;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 头部导航 -->
        <header class="header">
            <div class="header-content">
                <button class="back-btn" id="backBtn">←</button>
                <div class="header-title">选择位置</div>
                <button class="action-btn" id="saveBtn">确定</button>
            </div>
        </header>

        <!-- 搜索区域 -->
        <div class="search-section">
            <div class="search-container">
                <span class="search-icon">🔍</span>
                <input type="text" class="search-input" placeholder="搜索地点..." id="locationSearch">
            </div>
        </div>

        <!-- 地图区域 -->
        <div class="map-section">
            <div class="map-placeholder">
                <span>地图显示区域</span>
            </div>
            <div class="map-marker">📍</div>
        </div>

        <!-- 当前位置区域 -->
        <div class="current-location">
            <div class="location-header">
                <span class="location-icon">📍</span>
                <div class="location-info">
                    <div class="location-name">当前位置</div>
                    <div class="location-address">北京市朝阳区建国路88号</div>
                    <div class="location-indicator">
                        <span class="indicator-dot"></span>
                        <span class="indicator-text">定位中...</span>
                    </div>
                </div>
                <div class="location-actions">
                    <button class="action-btn use-location-btn" id="useCurrentBtn">使用</button>
                </div>
            </div>
        </div>

        <!-- 地区选择区域 -->
        <div class="region-section">
            <h3 class="section-title">附近地区</h3>
            <div class="region-list">
                <div class="region-item active" data-region-id="1">北京市</div>
                <div class="region-item" data-region-id="2">上海市</div>
                <div class="region-item" data-region-id="3">广州市</div>
                <div class="region-item" data-region-id="4">深圳市</div>
                <div class="region-item" data-region-id="5">杭州市</div>
                <div class="region-item" data-region-id="6">成都市</div>
            </div>
        </div>

        <!-- 搜索结果区域 -->
        <div class="search-results">
            <div class="results-header">
                <h3 class="results-title">搜索结果</h3>
                <div class="results-count">约24个地点</div>
            </div>
            
            <div class="result-item" data-location-id="1">
                <span class="result-icon">📍</span>
                <div class="result-info">
                    <div class="result-name">城市公园</div>
                    <div class="result-address">朝阳区建国路88号附近</div>
                </div>
            </div>

            <div class="result-item" data-location-id="2">
                <span class="result-icon">📍</span>
                <div class="result-info">
                    <div class="result-name">咖啡书店</div>
                    <div class="result-address">朝阳区建国路99号</div>
                </div>
            </div>

            <div class="result-item" data-location-id="3">
                <span class="result-icon">📍</span>
                <div class="result-info">
                    <div class="result-name">创意工坊</div>
                    <div class="result-address">朝阳区建国路108号</div>
                </div>
            </div>

            <div class="result-item" data-location-id="4">
                <span class="result-icon">📍</span>
                <div class="result-info">
                    <div class="result-name">美食街</div>
                    <div class="result-address">朝阳区建国路120号</div>
                </div>
            </div>

            <div class="result-item" data-location-id="5">
                <span class="result-icon">📍</span>
                <div class="result-info">
                    <div class="result-name">城市广场</div>
                    <div class="result-address">朝阳区建国路150号</div>
                </div>
            </div>

            <div class="result-item" data-location-id="6">
                <span class="result-icon">📍</span>
                <div class="result-info">
                    <div class="result-name">图书馆</div>
                    <div class="result-address">朝阳区建国路200号</div>
                </div>
            </div>
        </div>

        <!-- 底部导航 -->
        <nav class="bottom-nav">
            <div class="nav-item" data-page="home">
                <span class="nav-icon">🏠</span>
                <span>首页</span>
            </div>
            <div class="nav-item" data-page="search">
                <span class="nav-icon">🔍</span>
                <span>搜索</span>
            </div>
            <div class="nav-item" data-page="publish">
                <span class="nav-icon">➕</span>
                <span>发布</span>
            </div>
            <div class="nav-item active" data-page="profile">
                <span class="nav-icon">👤</span>
                <span>我的</span>
            </div>
        </nav>

        <!-- 加载状态 -->
        <div class="loading" id="loadingIndicator">
            <div class="spinner"></div>
            <p>定位中...</p>
        </div>

        <!-- 通知 Toast -->
        <div id="toast" style="display: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #4caf50; color: white; padding: 12px 24px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1001;"></div>
    </div>

    <script>
        // 全局变量
        let selectedLocation = {
            id: 1,
            name: '城市公园',
            address: '朝阳区建国路88号附近'
        };
        
        let selectedRegion = 1; // 当前选中的地区

        // 初始化
        document.addEventListener('DOMContentLoaded', function() {
            initEventListeners();
            simulateLoading();
            
            // 模拟定位完成
            setTimeout(() => {
                updateLocationStatus('已定位到当前位置');
                hideLoading();
            }, 2000);
        });

        // 初始化事件监听器
        function initEventListeners() {
            // 返回按钮
            document.getElementById('backBtn').addEventListener('click', function() {
                window.history.back();
            });

            // 保存按钮
            document.getElementById('saveBtn').addEventListener('click', function() {
                showSuccessToast(`已选择位置：${selectedLocation.name}`);
                
                // 模拟保存成功后返回
                setTimeout(() => {
                    alert(`位置已保存：${selectedLocation.name}\n地址：${selectedLocation.address}`);
                }, 1000);
            });

            // 底部导航切换
            const navItems = document.querySelectorAll('.nav-item');
            navItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    navItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    const page = this.dataset.page;
                    handleNavigation(page);
                });
            });

            // 使用当前位置按钮
            document.getElementById('useCurrentBtn').addEventListener('click', function() {
                showSuccessToast('已使用当前位置');
            });

            // 地区选择
            const regionItems = document.querySelectorAll('.region-item');
            regionItems.forEach(item => {
                item.addEventListener('click', function() {
                    // 移除所有激活状态
                    regionItems.forEach(i => i.classList.remove('active'));
                    // 添加当前激活状态
                    this.classList.add('active');
                    
                    selectedRegion = parseInt(this.dataset.regionId);
                    showSuccessToast(`已选择地区：${this.textContent}`);
                });
            });

            // 搜索功能
            const searchInput = document.getElementById('locationSearch');
            searchInput.addEventListener('input', function() {
                const searchTerm = this.value.toLowerCase();
                filterLocations(searchTerm);
            });

            // 位置选择
            const resultItems = document.querySelectorAll('.result-item');
            resultItems.forEach(item => {
                item.addEventListener('click', function() {
                    const locationId = this.dataset.locationId;
                    const nameElement = this.querySelector('.result-name');
                    const addressElement = this.querySelector('.result-address');
                    
                    selectedLocation = {
                        id: locationId,
                        name: nameElement.textContent,
                        address: addressElement.textContent
                    };
                    
                    // 更新显示状态
                    resultItems.forEach(i => i.style.backgroundColor = 'transparent');
                    this.style.backgroundColor = '#e3f2fd';
                    
                    showSuccessToast(`已选择位置：${selectedLocation.name}`);
                });
            });

            // 模拟地理位置更新
            setInterval(() => {
                updateLocationStatus('位置已更新');
            }, 30000); // 每30秒更新一次
        }

        // 更新位置状态显示
        function updateLocationStatus(status) {
            const indicatorText = document.querySelector('.indicator-text');
            if (indicatorText) {
                indicatorText.textContent = status;
                
                // 更新指示器颜色
                const indicatorDot = document.querySelector('.indicator-dot');
                if (status === '已定位到当前位置') {
                    indicatorDot.style.backgroundColor = '#4caf50';
                } else if (status === '位置已更新') {
                    indicatorDot.style.backgroundColor = '#ff9800';
                }
            }
        }

        // 过滤位置
        function filterLocations(searchTerm) {
            const resultItems = document.querySelectorAll('.result-item');
            
            resultItems.forEach(item => {
                const nameElement = item.querySelector('.result-name');
                const addressElement = item.querySelector('.result-address');
                
                const name = nameElement.textContent.toLowerCase();
                const address = addressElement.textContent.toLowerCase();
                
                if (searchTerm === '' || name.includes(searchTerm) || address.includes(searchTerm)) {
                    item.style.display = 'flex';
                } else {
                    item.style.display = 'none';
                }
            });
        }

        // 处理导航切换
        function handleNavigation(page) {
            switch(page) {
                case 'home':
                    alert('跳转到首页');
                    break;
                case 'search':
                    alert('跳转到搜索页面');
                    break;
                case 'publish':
                    alert('跳转到发布页面');
                    break;
                case 'profile':
                    // 个人中心无需特殊处理
                    break;
            }
        }

        // 显示加载状态
        function showLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'block';
        }

        // 隐藏加载状态
        function hideLoading() {
            const loading = document.getElementById('loadingIndicator');
            loading.style.display = 'none';
        }

        // 模拟加载效果
        function simulateLoading() {
            showLoading();
            setTimeout(() => {
                hideLoading();
            }, 2000);
        }

        // 显示成功提示
        function showSuccessToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                toast.style.display = 'none';
            }, 3000);
        }

        // 添加触摸反馈效果
        const buttons = document.querySelectorAll('button, .region-item, .result-item');
        buttons.forEach(button => {
            button.addEventListener('touchstart', function() {
                this.style.transform = 'scale(0.98)';
            });
            
            button.addEventListener('touchend', function() {
                this.style.transform = 'scale(1)';
            });
        });

        // 添加页面滚动效果
        let lastScrollTop = 0;
        window.addEventListener('scroll', function() {
            const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            // 隐藏/显示底部导航
            const bottomNav = document.querySelector('.bottom-nav');
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                bottomNav.style.transform = 'translateY(100%)';
            } else {
                bottomNav.style.transform = 'translateY(0)';
            }
            
            lastScrollTop = scrollTop;
        });

        // 添加返回顶部功能
        window.addEventListener('scroll', function() {
            if (window.pageYOffset > 300) {
                // 可以添加返回顶部按钮
            }
        });
    </script>
</body>
</html>
